package com.qing.library_manager.common.config;

import com.qing.library_manager.common.util.SnowFlakeIdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.Stack;

/**
 * <p>TODO</p>
 *
 * @author Yjx
 * @version 1.0.0
 * @since 2021/11/25
 **/
@Configuration
public class BeanConfig {

    /**
     * id生成
     *
     * @return SnowFlakeIdWorker
     */
    @Bean
    public SnowFlakeIdWorker snowFlakeIdWorker() {
        return new SnowFlakeIdWorker(0, 0);
    }

    /**
     * security中的 BCryptPasswordEncoder 加密算法
     * @return BCryptPasswordEncoder
     */
    @Bean
    public BCryptPasswordEncoder createPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

}
